package band.wukong.practice.springboot.boot.web.exception;

import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * @author wukong(wukonggg@139.com)
 */
//@ControllerAdvice(basePackages = "band.wukong.practice.springboot.boot.web.exception")
public class GlobalExceptionHandlerInStringView {

    @ExceptionHandler(Exception.class)
    @ResponseBody
    public String handleException(Exception e) {
        if (e instanceof ArithmeticException) {
            return "全局-算数异常";
        } else {
            return "全局-非算数异常";
        }
    }

}
